import 'package:flutter/material.dart';
import 'package:flutter_kit_dsp/app/core/model/model.dart';
import 'package:flutter_kit_plus/flutter_kit.dart';

class PassSlider extends StatefulWidget {
  final int flex1;
  final int flex2;
  Passmodel model;
  final void Function(double) onChange;
  final void Function(double) onChangedForSend;

  PassSlider(
      {super.key,
      required this.flex1,
      required this.flex2,
      required this.model,
      required this.onChange,
      required this.onChangedForSend});

  @override
  State<PassSlider> createState() => _PassSliderState();
}

class _PassSliderState extends State<PassSlider> {
  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisAlignment: MainAxisAlignment.end,
      children: [
        Flexible(flex: widget.flex1, child: Container()),
        Flexible(
          flex: widget.flex2,
          child: kSlider(
            dirction: Axis.vertical,
            value: widget.model.freq.toDouble(),
            min: 20,
            max: 20000,
            enable: widget.model.select,
            milliseconds: 200,
            onChanged: widget.model.select ? (p0) => widget.onChange(p0) : null,
            onChangedForSend: widget.model.select ? widget.onChangedForSend : null,
          ),
        ),
      ],
    );
  }
}
